package com.jxtc.enterprise.common.constants;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public enum DeliveryCostTypeEnum {
    /**
     * 每单结算
     */
    PER_ORDER("PER_ORDER", 1),
    /**
     * 按订单金额百分比抽成
     */
    PERCENTAGE_OF_ORDER("PERCENTAGE", 2),
    /**
     * 固定金额包干
     */
    FIXED_AMOUNT("FIXED_AMOUNT", 3),
    ;

    private final String name;
    private final int code;

    DeliveryCostTypeEnum(String name, int code) {
        this.name = name;
        this.code = code;
    }

    /**
     * 获取所有合法的配送费用类型名称
     */
    public static List<String> names() {
        List<String> nameList = new ArrayList<>(3);
        for (DeliveryCostTypeEnum type : DeliveryCostTypeEnum.values()) {
            nameList.add(type.getName());
        }
        return nameList;
    }
}
